from PyQt5 import QtCore
from pkg.gui import CurrencyLineInputWindow,CurrencyTextInputWindow,CurrencyShowWindow


class driver_obj(QtCore.QObject):
    get_input = QtCore.pyqtSignal(str)

    def __init__(self):
        QtCore.QObject.__init__(self)

    def on_get_text_input(self,txt):
        w=CurrencyTextInputWindow.CurrencyTextInputWindow(txt)
        if w.exec()==1:
            self.get_input.emit(w.text_input.toPlainText())
        else:
            self.get_input.emit('')

    def on_get_line_input(self,txt):
        w = CurrencyLineInputWindow.CurrencyLineInputWindow(txt)
        if w.exec() == 1:
            self.get_input.emit(w.text_input.text())
        else:
            self.get_input.emit('')

    def on_show_content(self,txt):
        w=CurrencyShowWindow.CurrencyShowWindow(txt)
        w.exec()
        self.get_input.emit('')


class recv_obj(QtCore.QObject):
    content=''
    sgn=QtCore.pyqtSignal(str)

    def __init__(self):
        QtCore.QObject.__init__(self)

    def get_input(self):
        return self.content

    def recv_input(self,txt):
        self.content=txt